1. Field of the Invention
The present invention is related to a mechanism for storing and retrieving dynamically changing data. Particularly, the present invention is related to a method and system for persistently storing objects of an object oriented environment and restoring such objects respectively.
2. Description of the Related Art
An object oriented environment provides all necessary mechanisms, tools and functionality to realize a method and system according to the concepts of object oriented design. Object oriented design is a design method in which a system is modeled as a collection of cooperating objects wherein individual objects are treated as instances of a class within a class hierarchy. Four stages can be identified in object oriented design, i.e., identifying the classes and objects, their semantics, their relationships and specifying class and object interfaces and implementation. Object-oriented design is one of the stages of object-oriented programming.
In object-oriented programming the expression “object” refers to a unique instance of a data structure defined according to a template provided by its class. Each object has its own values for the variables belonging to its class and can respond to the messages and methods defined by its class.
A class, on the other hand, is a prototype for an object in an object-oriented language, analogous to a derived type in a procedural language and may also be considered to be a set of objects which share a common structure and behavior. The structure of a class is determined by the class variables which represent the state of an object of that class whereas the behavior is given by a set of methods associated with the class.
Classes are related in a class hierarchy. One class may be a specialization, a so called “subclass” of another or it may be composed of other classes or it may use other classes in a client-server relationship.
The state of an object is its configuration, attributes, condition, or information content. The state of an object is usually temporary, i.e. it changes with time, and is volatile, i.e., it will be lost or reset to some initial state, if a system running in an object oriented environment is switched off. Therefore, there is a major need for mechanisms to store the state of an object persistently in a way that a new object having the particular state can be created at any time. In other words, a concept needs to be implemented where created objects and variables continue to exist and retain their values between runs of the system.
To improve readability, in the following, the expression “to store an object” will be used synonymously to the expression “to store the state of an object”.
During operation of a system running in an object oriented environment multiple objects get created, modified and deleted. In many cases existing objects need to be available after the termination of the system's operation and a restart of the system respectively. In order to extend the availability of an object beyond the operation of the respective system, the object needs to be saved to a persistent storage, i.e., a device into which data can be entered, in which they can be held, and from which they can be retrieved at a later time, such as a tape, a floppy, a hard drive or some optical storage. However, the data structure used to access the persistent storage might also differ. It can be organized like a data base, files, queues or directories.
More generally, in order to provide persistency in an object oriented environment a persistent medium is required, i.e., the medium in which the objects get stored. Such a persistent medium can be formed, e.g., by a data base, files, queues or directories. Between the objects which reside in a volatile memory during operation of the system and the persistent medium an intermediate layer is required that functions as an adapter. This adapting layer will be called “persistent data layer”. It is the task of the persistent data layer to conduct the storing and recreating of the objects persistently stored in the persistent medium.
In a known concept for persistently storing objects all objects to be stored get serialized into a stream and saved on the persistent medium. This concept, however, realizes a static persistence, i.e., after storing the objects loose their accessibility. New objects cannot be added to the stream, obsolete objects cannot be deleted and changed objects cannot be altered directly in the stream stored on the persistent medium.
A more flexible way of persistently storing objects is by using an object oriented database, i.e., a system that encapsulates a database management system functioning as the persistent data layer and the persistent medium. The access to the persistent medium is conducted by the database management system and it is completely hidden from the point of view of the objects to be stored. However, additional measures have to be taken in order to convert the objects from their internal run-time representation into a format suitable for the object oriented database. Especially, in case the objects contain data fields of a variable length, the conversion process from the run-time representation into a database representation of the objects adds additional overhead to the object oriented environment. Such overhead might reduce the performance of a system running in such an environment drastically. This holds true especially for systems frequently storing modified or newly created objects.